[[package]]
name = "encoding"
version = "0.1.0"
--source = "git+https://github.com/lifthrasiir/rust-encoding#15de58b9cb1fb5998aa6217e794d557eaf80a31f"
++source = "git+https://github.com/lifthrasiir/rust-encoding#35f0d70f65f73ba16f296f9ec675eddee661ba79"
[[package]]
name = "flate2"
version = "0.1.0"
source = "git+https://github.com/servo/rust-url#bb68de835ad945a72fba44979944a587ba83941a"
dependencies = [
-- "encoding 0.1.0 (git+https://github.com/lifthrasiir/rust-encoding#15de58b9cb1fb5998aa6217e794d557eaf80a31f)",
++ "encoding 0.1.0 (git+https://github.com/lifthrasiir/rust-encoding#35f0d70f65f73ba16f296f9ec675eddee661ba79)",
]
Options:
-h, --help Print this message
- --git Initialize a new git repository with a .gitignore
+ --no-git Don't initialize a new git repository
+ --git Initialize a new git repository, overriding a
+ global `git = false` configuration
+ --travis Create a .travis.yml file
--bin Use a binary instead of a library template
-v, --verbose Use verbose output
")
debug!("executing; cmd=cargo-new; args={}", os::args());
shell.set_verbose(options.flag_verbose);
- let Options { flag_git, flag_travis, flag_bin, arg_path, .. } = options;
- let Options { flag_no_git, flag_bin, arg_path, flag_git, .. } = options;
++ let Options { flag_no_git, flag_travis, flag_bin, arg_path, flag_git, .. } = options;
let opts = ops::NewOptions {
+ no_git: flag_no_git,
git: flag_git,
+ travis: flag_travis,
path: arg_path.as_slice(),
bin: flag_bin,
};
use core::shell::MultiShell;
pub struct NewOptions<'a> {
+ pub no_git: bool,
pub git: bool,
+ pub travis: bool,
pub bin: bool,
pub path: &'a str,
}
gitignore.push_str("/Cargo.lock\n");
}
try!(File::create(&path.join(".gitignore")).write(gitignore.as_bytes()));
- } else {
- try!(fs::mkdir(path, io::UserRWX));
}
- let author = try!(discover_author());
+ let (author_name, email) = try!(discover_author());
+ // Hoo boy, sure glad we've got exhaustivenes checking behind us.
+ let author = match (cfg.name, cfg.email, author_name, email) {
+ (Some(name), Some(email), _, _) |
+ (Some(name), None, _, Some(email)) |
+ (None, Some(email), name, _) |
+ (None, None, name, Some(email)) => format!("{} <{}>", name, email),
+ (Some(name), None, _, None) |
+ (None, None, name, None) => name,
+ };
+
+ if opts.travis {
+ try!(File::create(&path.join(".travis.yml")).write_str("language: rust\n"));
+ }
+
try!(File::create(&path.join("Cargo.toml")).write_str(format!(
r#"[package]